package com.wjh.controller;


import com.wjh.pojo.Expressage;
import com.wjh.service.ExpressageService;
import com.wjh.utils.ResponseResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("expressage")
public class ExpressageController {

    @Resource
    private ExpressageService expressageService;

    @GetMapping("/list")
    public ResponseResult getExpressageAll(Integer pageNum,Integer pageSize,String phone,
                                                String orderNumber,String fetchGoodsNumber,Integer state){
        return expressageService.getExpressageAll(pageNum,pageSize,phone,orderNumber,fetchGoodsNumber,state);
    }

    /**
     * 修改包裹数据
     * @param expressage
     * @return
     */
    @PutMapping("/update")
    public ResponseResult updateExpressage(@RequestBody Expressage expressage){
        return expressageService.updateExpressage(expressage);
    }

    /**
     * 添加包裹数据
     * @param expressage
     * @return
     */
    @PostMapping("/add")
    public ResponseResult addExpressage(@RequestBody Expressage expressage){
        return expressageService.addExpressage(expressage);
    }

    @DeleteMapping("/del/{id}")
    public ResponseResult delExpressageByIds(@PathVariable("id")List<Integer> id){
        return expressageService.delExpressageByIds(id);
    }
}
